﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="GPSImei.aspx.cs" Inherits="GPSTrackingWebsiteManager.Pages.GPSImei" %>

<!DOCTYPE html>
<link href="../Css/GPSTrackingWebsite.css" rel="stylesheet" />
<script src="../Javascript/WindowMessageManager.js"></script>
<script src="../Javascript/ObjectsV2.js"></script>

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title>Grupos de GPS</title>
</head>  
    <telerik:RadScriptBlock ID="RadScriptBlock1" runat="server">
        <script type="text/javascript">

            var opener = GetRadWindow();
            var GPSImei = new GPSImei();

            function GetRadWindow() {
                var oWindow = null;
                if (window.radWindow)
                    oWindow = window.radWindow;
                else if (window.frameElement.radWindow)
                    oWindow = window.frameElement.radWindow;
                return oWindow.BrowserWindow;
            }

            function getMenuVehicleTree() {
                return $find('<%= TreeMenuView.ClientID %>');
            }

            function getGroupsTrackDataLastLocationByUser() {

                var tree;

                try {
                    tree = getMenuVehicleTree();
                    tree.get_nodes().clear();
                }
                catch (e) { null; }


                PageMethods.wsGetGroupsTrackDataLastLocationByUser(getGroupsTrackDataLastLocationByUserOk, getGroupsTrackDataLastLocationByUserError);
            }

            function loadGPSImeiTreeWait()
            {
                GPSImei.loadGPSImeiTree(getMenuVehicleTree(), opener);
                responseEnd(getrpvGPSImeiUpdateControl());
            }

            function getGroupsTrackDataLastLocationByUserOk(xmlObject) {
                requestStart(getrpvGPSImeiUpdateControl());
                GPSImei.openXMLTrackDataLastLocationGroupsImei(xmlObject, opener);
                setTimeout(loadGPSImeiTreeWait, 10);
            }

            function getGroupsTrackDataLastLocationByUserError(error) {
                opener.msgError(error.get_message(), titles.polygonoTitle);
            }

            function centerImeiTrackDataLastLocationOnClick() {
                GPSImei.showGPSImeiSelected(getMenuVehicleTree(), opener);
            }

            function getrpvGPSImeiUpdateControl() {
                return "<%=  rpvGPSImei.ClientID %>";
            }

            function requestStart(object) {
                try {
                    $find("<%= RadAjaxLoadingPanel1.ClientID%>").show(object);
                }
                catch (e) {
                    null;
                }
            }

            function responseEnd(object) {
                //hide the loading panel and clean up the global variables 
                try {
                    $find("<%= RadAjaxLoadingPanel1.ClientID%>").hide(object);
                }
                catch (e) {
                    null;
                }
            }
        </script>
    </telerik:RadScriptBlock>

<body onload="getGroupsTrackDataLastLocationByUser()" >
    <form id="form1" runat="server">
    <telerik:RadScriptManager ID="RadScriptManager1" runat="server" EnablePageMethods="true" EnablePartialRendering="true"></telerik:RadScriptManager>
        <telerik:RadAjaxManager ID="RadAjaxManager1" runat="server">
            <AjaxSettings>
				<telerik:AjaxSetting AjaxControlID="AjaxControlID1">
					<UpdatedControls>
						<telerik:AjaxUpdatedControl ControlID="Loading" LoadingPanelID="RadAjaxLoadingPanel1" />
					</UpdatedControls>
				</telerik:AjaxSetting>
			</AjaxSettings>
        </telerik:RadAjaxManager>

        <telerik:RadTabStrip ID="rtsGPSImei" runat="server" SelectedIndex="0" MultiPageID="rmpGPSImei" Skin="Metro"></telerik:RadTabStrip>
        <telerik:RadMultiPage ID="rmpGPSImei" runat="server" SelectedIndex="0">
            <telerik:RadPageView ID="rpvGPSImei" runat="server">

                    <telerik:RadTreeView ID="TreeMenuView" runat="server" OnClientNodeClicked="centerImeiTrackDataLastLocationOnClick"></telerik:RadTreeView>

            </telerik:RadPageView>
        </telerik:RadMultiPage>

        <telerik:RadAjaxLoadingPanel ID="RadAjaxLoadingPanel1" runat="server" Skin="Default"></telerik:RadAjaxLoadingPanel>

    </form>
</body>
</html>
